<html>
    <head>
        <?php
        session_start();

        if (!isset($_SESSION['username'])) {
            header("location:index.php");
        }
        ?>

        <title>Health Promotion List</title>
        <link rel="stylesheet" href="style.css">
        <script src="jquery-1.11.0.js"></script>
        <script>
            var globalVar;
            var spanVarPar;

            var globalAddObj;

            function search(num) {
                cancel();

                if (num == 1) {
                    var search = $("#txtSearch").val();

                    if (search == "") {
                        $("#divStatus").text("Ha Ha Ha, you did not search for anything");
                        $("#divStatus").css({'color': 'yellow'});
                        return;
                    }
                    $("#searchTable").empty();
                    var u = "health_promotion_action.php?cmd=8&search=" + search;

                    r = syncAjax(u);

                    if (r.result == 0) {
                        //show error message
                        $("#divStatus").text("No Health Promotion Found");
                        $("#divStatus").css({'color': 'yellow'});
                        return;
                    }

                    $("#divStatus").text("Search results for: \"" + search + "\"");
                    $("#divStatus").css({'color': 'yellow'});

                    var tabl = $("#searchTable").closest("table");

                    var newRow = "row2";

//                  header
                    $(tabl).append("<tr class ='header'><td>#</td><td>Topic</td><td>Method</td><td>Date</td><td>Edit</td><td>Delete</td></tr>");

                    var i = 0;
                    while (i < r.found_promotions.length) {
//                        alert("elements");
                        var elements = "<tr class ='" + newRow + "'><td>" + r.found_promotions[i].promotion_id /*(i + 1)*/ + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")' class='hotspot1'>" + r.found_promotions[i].topic + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")'>" + r.found_promotions[i].method + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")'>" + r.found_promotions[i].date + "</td><td><span class='hotspot' onclick='edit(this," + r.found_promotions[i].promotion_id + ")'>edit<span></td><td><span class='hotspot2' onclick='del(this," + r.found_promotions[i].promotion_id + ")'>delete<span></td></tr>";
//                        alert(elements);
                        $(tabl).append(elements);
                        i++;
                        if (newRow == "row1") {
                            newRow = "row2";
                        }
                        else {
                            newRow = "row1";
                        }
                    }
                }
                else
                {
                    var u = "health_promotion_action.php?cmd=8&search= ";

                    $("#searchTable").empty();

                    r = syncAjax(u);
                    
                    var tabl = $("#searchTable").closest("table");

                    var newRow = "row2";
                    var entry = "<tr class ='header'><td>#</td><td>Topic</td><td>Method</td><td>Date</td><td>Edit</td><td>Delete</td></tr>";
//                header
                    $(tabl).append(entry);

                    var i = 0;
//                    alert(r.found_promotions.length);
                    while (i < r.found_promotions.length) {
//                        alert("elements");
                        var elements = "<tr class ='" + newRow + "'><td>" + r.found_promotions[i].promotion_id /*(i + 1)*/ + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")' class='hotspot1'>" + r.found_promotions[i].topic + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")'>" + r.found_promotions[i].method + "</td><td onclick='quickView(this," + r.found_promotions[i].promotion_id + ")'>" + r.found_promotions[i].date + "</td><td><span class='hotspot' onclick='edit(this," + r.found_promotions[i].promotion_id + ")'>edit<span></td><td><span class='hotspot2' onclick='del(this," + r.found_promotions[i].promotion_id + ")'>delete<span></td></tr>";
//                        alert(elements);
                        $(tabl).append(elements);
                        i++;
                        if (newRow == "row1") {
                            newRow = "row2";
                        }
                        else {
                            newRow = "row1";
                        }
                    }
                }
            }

            //makes asynchronous call to the page u and return the JSON object
            //result as object
            function syncAjax(u) {
                var obj = $.ajax({url: u, async: false});
                return $.parseJSON(obj.responseText);
            }

            function quickView(obj, id) {

                // cancel so you can load up a previous form
                cancel();

                var r = getHealthPromo(id);
                if (r.result == 0) {
                    //show error message
                    return;
                }
                //get the data from JSON object r and get the respective attributes from the object and load into the form
                $("#topicV").prop("value", r.promotion.topic);                        //       alert("topoc: "+r.promotion.topic);
                $("#methodV").prop("value", r.promotion.method);                       //      alert("alert"+r.promotion.method);
                $("#venueV").prop("value", r.promotion.venue);                          //     alert("alert"+r.promotion.venue);
                $("#dateV").prop("value", r.promotion.date);                            //     alert("alert"+r.promotion.date);
                $("#target_audienceV").prop("value", r.promotion.target_audience);         //  alert("alert"+r.promotion.target_audience);
                $("#number_of_audienceV").prop("value", r.promotion.number_of_audience);   //  alert("alert"+r.promotion.number_of_audience);
                $("#remarksV").prop("value", r.promotion.remarks);                         //  alert("alert"+r.promotion.remarks);
                $("#monthV option[value=" + r.promotion.month + "]").prop('selected', true);
                $("#latitudeV").prop("value", r.promotion.latitude);                       //  alert("alert"+r.promotion.latitude);
                $("#longitudeV").prop("value", r.promotion.longitude);                    //   alert("alert"+r.promotion.longitude);
                $("#imageV").prop("value", r.promotion.image);                            //   alert("alert"+r.promotion.image);
                $("#subdistrictV").prop("value", r.promotion.subdistrict_id);            //    alert("alert"+r.promotion.subdistrict_id);
                $("#idchoV").prop("value", r.promotion.cho_id);                          //    alert("alert"+r.promotion.cho_id);
                //show the form
                //find where the user clicked and store it in x and y
                var y = event.clientY;
                var x = event.clientX / 2;
                //use x and y to set the location of the form
                $("#divQuickView").css("top", y);
                $("#divQuickView").css("left", x);
                //display the form
                $("#divQuickView").fadeIn(250);

                globalVar = id;
                spanVarPar = $(obj).closest("tr");
            }

            function edit(obj, id) {

                // cancel so you can load up a previous form
                cancel();

                var r = getHealthPromo(id);
                if (r.result == 0) {
                    //show error message
                    return;
                }
                //get the data from JSON object r and get the respective attributes from the object and load into the form
                $("#topic").prop("value", r.promotion.topic);                        //       alert("topoc: "+r.promotion.topic);
                $("#method").prop("value", r.promotion.method);                       //      alert("alert"+r.promotion.method);
                $("#venue").prop("value", r.promotion.venue);                          //     alert("alert"+r.promotion.venue);
                $("#date").prop("value", r.promotion.date);                            //     alert("alert"+r.promotion.date);
                $("#target_audience").prop("value", r.promotion.target_audience);         //  alert("alert"+r.promotion.target_audience);
                $("#number_of_audience").prop("value", r.promotion.number_of_audience);   //  alert("alert"+r.promotion.number_of_audience);
                $("#remarks").prop("value", r.promotion.remarks);                         //  alert("alert"+r.promotion.remarks);
                $("#month option[value=" + r.promotion.month + "]").prop('selected', true);
                $("#latitude").prop("value", r.promotion.latitude);                       //  alert("alert"+r.promotion.latitude);
                $("#longitude").prop("value", r.promotion.longitude);                    //   alert("alert"+r.promotion.longitude);
                $("#image").prop("value", r.promotion.image);                            //   alert("alert"+r.promotion.image);
                $("#subdistrict").prop("value", r.promotion.subdistrict_id);            //    alert("alert"+r.promotion.subdistrict_id);
                $("#idcho").prop("value", r.promotion.cho_id);                          //    alert("alert"+r.promotion.cho_id);
                //show the form
                //find where the user clicked and store it in x and y
                var y = event.clientY;
                var x = event.clientX / 2;
                //use x and y to set the location of the form
                $("#divEdit").css("top", y);
                $("#divEdit").css("left", x);
                //display the form
                $("#divEdit").fadeIn(250);

                globalVar = id;
                spanVarPar = $(obj).closest("tr");
            }
            //returns a result object for one vaccine 
            function getHealthPromo(id) {
                var u = "health_promotion_action.php?cmd=1&idhp=" + id;
                return syncAjax(u);
            }
            //makes asynchronous call to the save page
            function save() {

                //complete the url
                var vtop = document.getElementById("topic").value;
                var vmeth = document.getElementById("method").value;
                var vven = document.getElementById("venue").value;
                var vdat = document.getElementById("date").value;
                var vtar = document.getElementById("target_audience").value;
                var vnum = document.getElementById("number_of_audience").value;
                var vrem = document.getElementById("remarks").value;
                var vmon = document.getElementById("month").value;
                var vlat = document.getElementById("latitude").value;
                var vlon = document.getElementById("longitude").value;
                var vim = document.getElementById("image").value;
                var vsub = document.getElementById("subdistrict").value;
                var vidc = document.getElementById("idcho").value;

                var id = globalVar;

                var u = "health_promotion_action.php?cmd=4&idhp=" + id + "&date=" + vdat + "&ven=" + vven + "&top=" + vtop
                        + "&meth=" + vmeth + "&tar=" + vtar + "&num_aud=" + vnum + "&month=" + vmon + "&lat=" + vlat + "&lon=" + vlon + "&img=" + vim + "&sub_id=" + vsub + "&idcho=" + vidc + "&rmks=" + vrem;

                r = syncAjax(u);

//                alert(r.result);
                if (r.result == 4) { // signifies update
                    $("#divStatus").text("Health Promotion: \"" + vtop + "\" updated");
                    $("#divStatus").css({'color': 'yellow'});
                    //change things in the span
                    var nameCol = $(spanVarPar).children("td").get(1);
                    $(nameCol).text(vtop);
//                    $(nameCol).css({'color': 'violet', 'text-decoration':'underline', 'cursor':'hand' });

                    // method column change dymincs
                    var methodColumn = $(spanVarPar).children("td").get(2);
                    $(methodColumn).text(vmeth);

                    // date column change dymincs
                    var dateColumn = $(spanVarPar).children("td").get(3);
                    $(dateColumn).text(vdat);
                }
                else if (r.result == 5) { // signifies add

                    $("#divStatus").text("Health Promotion: \"" + vtop + "\" added");
                    $("#divStatus").css({'color': 'yellow'});

                    var tabl = $(globalAddObj).closest("table");
                    var lastRow = tabl.find("tr:last");

                    var newRow = $(lastRow).attr("class");
                    if (newRow == "row1") {
                        newRow = "row2";
                    }
                    else {
                        newRow = "row1";
                    }
//                    alert(tabl.get(0).tagName);
                    $(lastRow).after("<tr class ='" + newRow + "'><td onclick='quickView(this," + r.health_promotion.id + ")'>" + /*(r.health_promotion.rows + 1)*/ r.health_promotion.id + "</td><td class='hotspot1' onclick='quickView(this," + r.health_promotion.id + ")'>" + vtop + "</td><td onclick='quickView(this," + r.health_promotion.id + ")'>" + vmeth + "</td><td onclick='quickView(this," + r.health_promotion.id + ")'>" + vdat + "</td><td><span class='hotspot' onclick='edit(this," + r.health_promotion.id + ")'>edit<span></td><td><span class='hotspot2' onclick='del(this," + r.health_promotion.id + ")'>delete<span></td></tr>");

                }
                else {
                    alert(r.health_promotion);
                    alert("didn't add nor update. Could be because of '");
                    return;
                }
                cancel();
            }

            function saveDone(data) {
                alert(data);
            }

            function del(obj, id) {
                // cancel so you can load up a previous form
                cancel();
                var r = getHealthPromo(id);

                if (r.result == 0) {
                    //show error message
                    return;
                }
                //show the form
                //find where the user clicked and store it in x and y
                var y = event.clientY;
                var x = event.clientX / 1.5;
                //use x and y to set the location of the form based on mouse position
                $("#divDel").css("top", y);
                $("#divDel").css("left", x);
                //display the form
                $("#divDel").fadeIn(250);

                globalVar = id;
                spanVarPar = $(obj).closest("tr");
            }

            function rem() {
                // spanVarPar represents that hightlighted row
                spanVarPar.remove();

                var u = "health_promotion_action.php?cmd=3&idhp=" + globalVar;
                r = syncAjax(u);
                cancel();
                $("#divStatus").text("Health Promotion: \"" + r.topic + "\" deleted!");
                $("#divStatus").css({'color': 'yellow'});
            }

            function add(obj) {
                cancel();
                globalAddObj = obj;
                globalVar = 0;
                //get the data from JSON object r and get the respective attributes from the object and load into the form
                $("#topic").prop("value", "");                        //       alert("topoc: "+r.promotion.topic);
                $("#method").prop("value", "");                       //      alert("alert"+r.promotion.method);
                $("#venue").prop("value", "");                          //     alert("alert"+r.promotion.venue);
                $("#date").prop("value", "1990-01-01");                            //     alert("alert"+r.promotion.date);
                $("#target_audience").prop("value", "");         //  alert("alert"+r.promotion.target_audience);
                $("#number_of_audience").prop("value", 0);   //  alert("alert"+r.promotion.number_of_audience);
                $("#remarks").prop("value", "");                         //  alert("alert"+r.promotion.remarks);
                $("#month option[value=" + "January" + "]").prop('selected', true);
                $("#latitude").prop("value", 0);                       //  alert("alert"+r.promotion.latitude);
                $("#longitude").prop("value", 0);                    //   alert("alert"+r.promotion.longitude);
                $("#image").prop("value", "");                            //   alert("alert"+r.promotion.image);
                $("#subdistrict").prop("value", "1");            //    alert("alert"+r.promotion.subdistrict_id);
                $("#idcho").prop("value", "1");                          //    alert("alert"+r.promotion.cho_id);

                var y = event.clientY;
                var x = event.clientX / 2;

                $("#divEdit").css("top", y);
                $("#divEdit").css("left", x);
                $("#divEdit").fadeIn(250);
            }

            //hides the form
            function cancel() {
                //fade out the form in half a second
                $("#divEdit").fadeOut(250);
                $("#divDel").fadeOut(250);
                $("#divQuickView").fadeOut(250);
            }

            function logOut() {
                var url = "logout.php";
//                r = syncAjax(u);
                window.open(url, "_self");
            }
        </script>
        <?php
        include("./health_promotion.php");
        $h_obj = new health_promotion();
        if (!$h_obj->retrieveAll_promotion($_SESSION['start'])) {
            echo "error with retrieveAll_promotion in health_promotion_list around 370";
            exit();
        }
        if (!$h_obj->fetch()) {
            
        }
        ?>
        <?php
        $start = 0;


        if (isset($_REQUEST['start'])) {
            $_SESSION['start'] = $_SESSION['start'] + 1;
            if (!$h_obj->fetch()) {
                $_SESSION['start'] = $_SESSION['start'] - 2;
            }
            $start = $_SESSION['start'];
        } else if (isset($_REQUEST['sub'])) {
            $_SESSION['start'] = $_SESSION['start'] - 1;
            if ($_SESSION['start'] < 0) {
                $_SESSION['start'] = 0;
            }
            $start = $_SESSION['start'];
        }
        ?>
    </head>
    <body>
        <table>
            <tr>
                <td colspan="2" id="pageheader">
                    health information system
                </td>
            </tr>
            <tr>
                <td id="mainnav">
                    <div class="menuitem">location</div>
                    <div class="menuitem">opd cases</div>
                    <a href="health_promotion_list.php"><div class="menuitem">health promotion</div></a>
                    <div class="menuitem">nutrition</div>
                    <div class="menuitem">child welfare</div>
                    <div class="menuitem">family planning</div>
                </td>
                <td id="content">
                    <div id="divPageMenu">
                        <span class="menuitem" >sub districts</span>
                        <span class="menuitem" >communities</span>
                        <span class="menuitem" >view map</span>
                        <input type="text" id="txtSearch" >
                        <span class="menuitem" onclick="search(1)">search</span>		
                    </div>

                    <div id="divStatus" class="status">
                        status message
                    </div>
                    <div id="divPageMenuSub">
                        <a href="question_view.php"><span class="menuitem" >questions & anwers</span></a>
                        <!--<a href="#"><span class="menuitem" >answers</span></a>-->
                        <a><span class="menuitem" onclick = "search(0)">refresh</span></a>
                    </div>

                    <span id ="topicHeading" >Health Promotions</span>
                    <button class="field" onclick="add(this)" style="float: right;">ADD</button>
                    <table class="reportTable" width="100%" id="searchTable">
                        <tr class="header" >
                            <td>#</td>
                            <td>Topic</td>
                            <td>Method</td>
                            <td>Date</td>
                            <td>Edit</td>
                            <td>Delete</td>
                        </tr>
                        <?php
                        $obj = new health_promotion();
                        if (!$obj->retrieveAll_promotion($start)) {
                            echo "error with retrieveAll_promotion in health_promotion_list around 370";
                            exit();
                        }

                        $row = $obj->fetch();
                        $row_counter = 1;
//            -------------------to get cho name-----------------------
//            $health_promo_obj2->get_cho_by_promo($row['idhealth_promotion']);
//            $cho_name = $health_promo_obj2->fetch();
//
//            -------------------to get cho name-----------------------
                        while ($row) {
                            if ($row_counter % 2 == 0) {
                                $style = " class='row1' ";
                            } else {
                                $style = " class='row2' ";
                            }
                            $id = $row['idhealth_promotion'];
                            echo "<tr $style >";
//                            echo "<td>$id</td>";
                            echo "<td onclick='quickView(this,$id)'> $id</td>"; //$row_counter
//                            echo "<td><a href='health_promotion_detail.php?id=$id'>$row[topic]</a></td>";
                            echo "<td onclick='quickView(this,$id)'><span class='hotspot1' >$row[topic]</span></td>";
                            echo "<td onclick='quickView(this,$id)'>$row[method]</td>";
                            echo "<td onclick='quickView(this,$id)'>$row[date]</td>";
                            echo "<td><span class='hotspot' onclick='edit(this,$id)'>edit</span></td>";
                            echo "<td><span class='hotspot2' onclick='del(this,$id)'>delete</span></td>";
                            echo "</tr>";
                            $row = $obj->fetch();
                            $row_counter++;
                        }
                        ?>
                    </table>
                </td>
            </tr>
        </table>
        <form action="health_promotion_list.php" method="GET" class="field" style="float:right;">
            <<
            <!--<input type="submit" name="first" value="First" />-->
            <
            <input type="submit" name="sub" value="Previous" />
            <?php print $start + 1; ?>
            <input type="submit" name="start" value="Next" />
            >
            <!--<input type="submit" name="last" value="Last" />-->
            >>
        </form>

        <button onclick ="logOut()" >Log Out</button>

        <div id="divEdit" class="popupForm">
            <table class="tableForm" >
                <tr>
                    <td class="label">Topic: </td>
                    <td class="field"><input type="text" value="" id="topic" ></td>
                    <td class="label">Method:</td> 
                    <td class="field"><input type="text" value="" id="method" ></td>
                </tr>
                <tr>
                    <td class="label">Venue :</td>
                    <td class="field"><input type="text" value="" id="venue" ></td>
                    <td class="label">Date :</td>
                    <td class="field"><input type="date" value="" id="date" ></td>
                </tr>
                <tr>
                    <td class="label">Target Audience :</td>
                    <td class="field"><input type="text" value="" id="target_audience" ></td>
                    <td class="label">Number Of Audience :</td>
                    <td class="field"><input type="number" value="" id="number_of_audience" ></td>
                </tr>
                <tr>
                    <td class="label">Remarks :</td>
                    <td class="field" colspan="3"><textarea type="textarea" value="" id="remarks" ></textarea></td>

                </tr>
                <tr>
                    <td class="label">Latitude :</td>
                    <td class="field"><input type="number" value="" id="latitude" ></td>
                    <td class="label">Longitude :</td>
                    <td class="field"><input type="number" value="" id="longitude" ></td>
                </tr>
                <tr>
                    <td class="label">IDCHO :</td>
                    <td class="field">
                        <select id="idcho" name="inputIDCHO">
                            <?php
                            $health_promo2 = new health_promotion();
                            $health_promo2->retrieveAll_idcho();
                            $cho = $health_promo2->fetch();
                            while ($cho) {
                                echo "<option value =" . $cho["idcho"] . ">" . $cho["cho_name"] . "</option> ";
                                $cho = $health_promo2->fetch();
                            }
                            ?>
                        </select>
                    </td>
                    <td class="label">Subdistrict :</td>
                    <td class="field"><select id="subdistrict" name="inputSUBDISTRICT_ID" <?php ?>>
                            <!--<option>Select a Sub District</option>-->
                            <?php
                            $health = new health_promotion();
                            $subdistricts = null;
                            if (!$health->retrieveAll_subdistricts()) {
                                print "error: class err: " . mysql_error();
                            } else {
                                $subdistricts = $health->fetch();
                            }

                            while ($subdistricts) {
                                echo "<option value = " . $subdistricts["subdistrict_id"] . ">" . $subdistricts["subdistrict_name"] . "</option> ";
                                $subdistricts = $health->fetch();
                            }
                            ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label">Image :</td>
                    <td class="field"><input type="text" value="" id="image" ></td>
                    <td class="label">Month :</td>
                    <td class="field">
                        <select id="month" name="inputMONTH">
                            <option value="january">January</option>
                            <option value="february">February</option>
                            <option value="march">March</option>
                            <option value="april">April</option>
                            <option value="may">May</option>
                            <option value="june">June</option>
                            <option value="july">July</option>
                            <option value="august">August</option>
                            <option value="september">September</option>
                            <option value="october">October</option>
                            <option value="november">November</option>
                            <option value="december">December</option>
                        </select></td>
                </tr>
                <tr style="height: 20px;"></tr>
                <tr>
                    <td class="label"></td>
                    <td class="field"><input type="button" value="Save" onclick="save()" ></td>
                    <td class="label"></td>
                    <td class="field"><input type="button" value="Cancel" onclick="cancel()" ></td>
                </tr>
            </table>
        </div>
        <!------------------------------------------------quickview------------------------------------------------------->
        <div id="divQuickView" class="popupForm">
            <table class="tableForm" >
                <tr>
                    <td class="label">Topic: </td>
                    <td class="field"><input type="text" value="" id="topicV" disabled="true"></td>
                    <td class="label">Method:</td> 
                    <td class="field"><input type="text" value="" id="methodV" disabled="true"></td>
                </tr>
                <tr>
                    <td class="label">Venue :</td>
                    <td class="field"><input type="text" value="" id="venueV" disabled="true"></td>
                    <td class="label">Date :</td>
                    <td class="field"><input type="date" value="" id="dateV" disabled="true"></td>
                </tr>
                <tr>
                    <td class="label">Target Audience :</td>
                    <td class="field"><input type="text" value="" id="target_audienceV" disabled="true"></td>
                    <td class="label">Number Of Audience :</td>
                    <td class="field"><input type="number" value="" id="number_of_audienceV" disabled="true"></td>
                </tr>
                <tr>
                    <td class="label">Remarks :</td>
                    <td class="field" colspan="3"><textarea type="textarea" value="" id="remarksV" disabled="true"></textarea></td>

                </tr>
                <tr>
                    <td class="label">Latitude :</td>
                    <td class="field"><input type="number" value="" id="latitudeV" disabled="true" ></td>
                    <td class="label">Longitude :</td>
                    <td class="field"><input type="number" value="" id="longitudeV" disabled="true"></td>
                </tr>
                <tr>
                    <td class="label">IDCHO :</td>
                    <td class="field">
                        <select id="idchoV" name="inputIDCHO" disabled="true">
                            <?php
                            $health_promo3 = new health_promotion();              //  the constructor should be the name of the class
                            $health_promo3->retrieveAll_idcho();
                            $cho1 = $health_promo3->fetch();
                            while ($cho1) {
                                echo "<option value =" . $cho1["idcho"] . ">" . $cho1["cho_name"] . "</option> ";
                                $cho1 = $health_promo3->fetch();
                            }
                            ?>
                        </select>
                    </td>
                    <td class="label">Subdistrict :</td>
                    <td class="field"><select id="subdistrict" name="inputSUBDISTRICT_ID" disabled="true">
                            <?php
                            $health1 = new health_promotion();
                            $subdistricts1 = null;
                            if (!$health1->retrieveAll_subdistricts()) {
                                print "error: class err: " . mysql_error();
                            } else {
                                $subdistricts1 = $health1->fetch();
                            }
                            while ($subdistricts1) {
                                echo "<option value = " . $subdistricts1["subdistrict_id"] . ">" . $subdistricts1["subdistrict_name"] . "</option> ";
                                $subdistricts1 = $health1->fetch();
                            }
                            ?>
                        </select>

                    </td>
                </tr>
                <tr>
                    <td class="label" >Image :</td>
                    <td class="field"><input type="text" value="" id="imageV" disabled="true"></td>
                    <td class="label">Month :</td>
                    <td class="field">
                        <select id="monthV" name="inputMONTH" disabled="true">
                            <option value="january">January</option>
                            <option value="february">February</option>
                            <option value="march">March</option>
                            <option value="april">April</option>
                            <option value="may">May</option>
                            <option value="june">June</option>
                            <option value="july">July</option>
                            <option value="august">August</option>
                            <option value="september">September</option>
                            <option value="october">October</option>
                            <option value="november">November</option>
                            <option value="december">December</option>
                        </select></td>
                </tr>
                <tr style="height: 20px;"></tr>
                <tr>
                    <td class="label"></td>
                    <td class="label"></td>
                    <td class="label"></td>
                    <td class="field"><input type="button" value="OK" onclick="cancel()" ></td>
                </tr>
            </table>
        </div>

        <div id="divDel" class="popupForm">
            <table class="tableForm" >
                <tr>
                    <td colspan="2">Are you sure you want to delete?</td>
                </tr>
                <tr>
                    <td class="field"><input type="button" value="YES" onclick="rem()" ></td>
                    <td class="field"><input type="button" value="NO" onclick="cancel()" ></td>
                </tr>
            </table>
        </div>

    </body>
</html>	